﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace STRobot
{
    public partial class JumpPointAddWnd : Form
    {
        private int index_;
        private JumpTargetpoint jumptargetpoint_;
        public JumpPointAddWnd(int index = -1)
        {
            InitializeComponent();
            index_ = index;
            jumptargetpoint_ = new JumpTargetpoint();
            DialogResult = DialogResult.No;
        }
        public JumpPointAddWnd(JumpTargetpoint jump)
        {
            InitializeComponent();
            jumptargetpoint_ = jump;
            textBox2.Text = jumptargetpoint_.showname;
            textBox1.Text = jumptargetpoint_.targetname;
            textBox3.Text = jumptargetpoint_.npc;
            textBox4.Text = jumptargetpoint_.uiname;
        }
        //添加跳转步骤
        private void button1_Click(object sender, EventArgs e)
        {
            var wnd = new UiClickAddWnd(jumptargetpoint_.talk);
            wnd.Text = "跳转点步骤设置";
            if (wnd.ShowDialog() == DialogResult.OK)
            {
                var click = wnd.GetUiclicks();
                if (click != null)
                {
                    jumptargetpoint_.talk = click;
                }
            }
        }
        //保存此跳转点信息
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Length == 0 || textBox2.Text.Length == 0)
            {
                MessageBox.Show("需要填写落地地图名,大地图名");
                return;
            }
            jumptargetpoint_.showname = textBox2.Text;
            jumptargetpoint_.targetname = textBox1.Text;
            jumptargetpoint_.npc = textBox3.Text;
            jumptargetpoint_.uiname = textBox4.Text;
            DialogResult = DialogResult.OK;
            Close();
        }
        public JumpTargetpoint GetJupTargetPoint()
        {
            return jumptargetpoint_;
        }
    }
}
